﻿// Copyright (c) 2014 Morten Bakkedal
// This code is published under the MIT License.

using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;

using FuncLib.DualFunctions.Expressions;
using FuncLib.Functions;

namespace FuncLib.DualFunctions.Compilation
{
	internal class GeneratedFunction
	{
		private string identifier;
		private FunctionExpression expression;
		private FunctionValueStorage functionValueStorage;
		private SortedGradient gradient;
		private SortedHessian hessian;
		private Storage gradientStorage, hessianStorage;

		public GeneratedFunction(DualFunction function, FunctionValueStorage functionValueStorage, SortedGradient gradient, Storage gradientStorage, SortedHessian hessian, Storage hessianStorage)
		{
			this.functionValueStorage = functionValueStorage;
			this.gradient = gradient;
			this.gradientStorage = gradientStorage;
			this.hessian = hessian;
			this.hessianStorage = hessianStorage;

			identifier = "f" + function.FunctionIndex;
			expression = new FunctionExpression();
		}

		public FunctionExpression Expression
		{
			get
			{
				return expression;
			}
		}

		public FunctionValueStorage FunctionValueStorage
		{
			get
			{
				return functionValueStorage;
			}
		}

		public SortedGradient Gradient
		{
			get
			{
				return gradient;
			}
		}

		public Storage GradientStorage
		{
			get
			{
				return gradientStorage;
			}
		}

		public SortedHessian Hessian
		{
			get
			{
				return hessian;
			}
		}

		public Storage HessianStorage
		{
			get
			{
				return hessianStorage;
			}
		}
		
		public string Identifier
		{
			get
			{
				return identifier;
			}
		}
	}
}
